package org.example.lotterysystem.service.dto;

import org.example.lotterysystem.service.enums.ActivityPrizeStatusEnum;
import org.example.lotterysystem.service.enums.ActivityPrizeTiersEnum;
import org.example.lotterysystem.service.enums.ActivityStatusEnum;
import org.example.lotterysystem.service.enums.ActivityUserStatusEnum;

import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;

public class ActivityDetailDTO {
    /**
     * 活动信息
     */
    private Long activityId;

    /**
     * 活动名称
     */
    private String activityName;
    /**
     * 活动描述
     */
    private String desc;

    /**
     * 活动状态
     */
    private ActivityStatusEnum status;

    public Boolean valid(){
        return status.equals(ActivityStatusEnum.RUNNING);
    }
    /**
     * 奖品信息（列表）
     */
    private List<PrizeDTO> prizeDTOList;
    /**
     * 人员信息（列表）
     */
    private List<UserDTO> userDTOList;

    public Long getActivityId() {
        return activityId;
    }

    public void setActivityId(Long activityId) {
        this.activityId = activityId;
    }

    public String getActivityName() {
        return activityName;
    }

    public void setActivityName(String activityName) {
        this.activityName = activityName;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public ActivityStatusEnum getStatus() {
        return status;
    }

    public void setStatus(ActivityStatusEnum status) {
        this.status = status;
    }

    public List<PrizeDTO> getPrizeDTOList() {
        return prizeDTOList;
    }

    public void setPrizeDTOList(List<PrizeDTO> prizeDTOList) {
        this.prizeDTOList = prizeDTOList;
    }

    public List<UserDTO> getUserDTOList() {
        return userDTOList;
    }

    public void setUserDTOList(List<UserDTO> userDTOList) {
        this.userDTOList = userDTOList;
    }

    public static class PrizeDTO{
        /**
         * 奖品id
         */
        private Long prizeId;

        /**
         * 奖品名
         */
        private String name;

        /**
         * 图片索引
         */
        private String imageUrl;

        /**
         * 价格
         */
        private BigDecimal price;

        /**
         * 描述
         */
        private String description;
        /**
         * 奖品等级
         */
        private ActivityPrizeTiersEnum tiers;

        /**
         * 奖品数量
         */
        private Long prizeAmount;

        /**
         * 奖品状态
         */
        private ActivityPrizeStatusEnum status;
        public Boolean valid(){
            return status.equals(ActivityPrizeStatusEnum.INIT);
        }
        public Long getPrizeId() {
            return prizeId;
        }

        public void setPrizeId(Long prizeId) {
            this.prizeId = prizeId;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getImageUrl() {
            return imageUrl;
        }

        public void setImageUrl(String imageUrl) {
            this.imageUrl = imageUrl;
        }

        public BigDecimal getPrice() {
            return price;
        }

        public void setPrice(BigDecimal price) {
            this.price = price;
        }

        public String getDescription() {
            return description;
        }

        public void setDescription(String description) {
            this.description = description;
        }

        public ActivityPrizeTiersEnum getTiers() {
            return tiers;
        }

        public void setTiers(ActivityPrizeTiersEnum tiers) {
            this.tiers = tiers;
        }

        public Long getPrizeAmount() {
            return prizeAmount;
        }

        public void setPrizeAmount(Long prizeAmount) {
            this.prizeAmount = prizeAmount;
        }

        public ActivityPrizeStatusEnum getStatus() {
            return status;
        }

        public void setStatus(ActivityPrizeStatusEnum status) {
            this.status = status;
        }

        @Override
        public boolean equals(Object object) {
            if (this == object) return true;
            if (object == null || getClass() != object.getClass()) return false;
            PrizeDTO prizeDTO = (PrizeDTO) object;
            return Objects.equals(prizeId, prizeDTO.prizeId) && Objects.equals(name, prizeDTO.name) && Objects.equals(imageUrl, prizeDTO.imageUrl) && Objects.equals(price, prizeDTO.price) && Objects.equals(description, prizeDTO.description) && tiers == prizeDTO.tiers && Objects.equals(prizeAmount, prizeDTO.prizeAmount) && status == prizeDTO.status;
        }

        @Override
        public int hashCode() {
            return Objects.hash(prizeId, name, imageUrl, price, description, tiers, prizeAmount, status);
        }
    }
    public static class UserDTO{
        /**
         * 用户id
         */
        private Long userId;
        /**
         * 姓名
         */
        private String userName;

        /**
         * 状态
         */
        private ActivityUserStatusEnum status;
        public Boolean valid(){
            return status.equals(ActivityUserStatusEnum.INIT);
        }

        public Long getUserId() {
            return userId;
        }

        public void setUserId(Long userId) {
            this.userId = userId;
        }

        public String getUserName() {
            return userName;
        }

        public void setUserName(String userName) {
            this.userName = userName;
        }

        public ActivityUserStatusEnum getStatus() {
            return status;
        }

        public void setStatus(ActivityUserStatusEnum status) {
            this.status = status;
        }

        @Override
        public boolean equals(Object object) {
            if (this == object) return true;
            if (object == null || getClass() != object.getClass()) return false;
            UserDTO userDTO = (UserDTO) object;
            return Objects.equals(userId, userDTO.userId) && Objects.equals(userName, userDTO.userName) && status == userDTO.status;
        }

        @Override
        public int hashCode() {
            return Objects.hash(userId, userName, status);
        }
    }

}
